10 '***************************************************************************
20 '*                                                                         *
30 '*                               KILL.BAS                                  *
40 '*                                                                         *
50 '*                       BY ROBERT RELF (70176,403)                        *
60 '*                                                                         *
70 '*                               (C) 1983                                  *
80 '*                                                                         *
90 '***************************************************************************
100 '
110 '         REQUIRES DOS 2.00,COLOR GRAPHICS ADAPTER,2 DISK DRIVES
120 '         FORMAT A DISK WITH THE "/S" OPTION
130 '         COPY ONTO IT: KILL.BAS,BASICA.COM,COMMAND.COM,SORT.EXE
140 '         OR RUN WITH DOS DISK IN DRIVE "A"
150 '         REMOVE APOSTROPHE FROM LINE 180 FOR COLOR MONITOR OR
160 '         FROM LINE 190 FOR NON-IBM MONOCHROME MONITOR
170 '
180 COL1=1:COL2=2:COL4=4:COL5=5:COL7=7:COL10=10:COL14=14:COL15=15
190 'COL1=0:COL2=15:COL4=15:COL5=15:COL7=7:COL10=7:COL14=15:COL15=15
195 GOSUB 50000  'switch to color/graphics   ** Added by Tom D. Hall **
200 KEY OFF:SCREEN 0,1:COLOR COL15,0,0:WIDTH 40:CLS:LOCATE 5,19:PRINT "IBM"
210 LOCATE 7,12,0:PRINT "Personal Computer"
220 COLOR COL10,0:LOCATE 10,5,0:PRINT CHR$(213)+STRING$(31,205)+CHR$(184)
230 LOCATE 11,5,0:PRINT CHR$(179)+"             KILL              "+CHR$(179)
240 LOCATE 12,5,0:PRINT CHR$(179)+"                               "+CHR$(179)
250 LOCATE 13,5,0:PRINT CHR$(179)+STRING$(31,32)+CHR$(179)
260 LOCATE 14,5,0:PRINT CHR$(179)+"         Version 1.00          "+CHR$(179)
270 LOCATE 15,5,0:PRINT CHR$(212)+STRING$(31,205)+CHR$(190)
280 COLOR COL15,0:LOCATE 17,6,0:PRINT "(C) Copyright  Rob Relf  1983"
290 COLOR COL14,0:LOCATE 23,7,0:PRINT "Press space bar to continue"
300 DEF SEG : POKE 106,0          'CLEAR KEYBOARD BUFFER
310 IK$=INKEY$ : IF IK$ = "" THEN GOTO 310
320 ON ERROR GOTO 1360
330 DEF SEG=0:POKE &H417,192      'CAPS LOCK / NUM LOCK ON
340 SCREEN ,,1,1:WIDTH 80:COLOR COL7,COL1,COL1:CLS:DIM FILE$(200):ROW=10
350 PRINT "THIS IS A PROGRAM FOR DELETING MULTIPLE FILES FROM THE SELECTED DISK.
360 PRINT "UP TO 80 FILES MAY BE DELETED IN ONE SESSION.
370 PRINT "WHICH DISK DO YOU WISH TO ERASE FILES FROM ?";
380 PRINT " PLEASE TYPE THE DRIVE LETTER.
390 B$=INKEY$
400 IF B$="" THEN GOTO 390
410 IF ASC(B$)>68 OR  ASC(B$)<65 THEN BEEP:GOTO 390  'TEST FOR "A" TO "D"
420 CLS
430 SHEL$="DIR "+B$+":| SORT > FILE.LST":GOSUB 1380 'SORT DIR TO DISK FILE
440 SCREEN ,,1,1:CLS
450 LOCATE 3,1:COLOR COL5
460 PRINT STRING$(45,205);CHR$(203);STRING$(34,205);
470 FOR X=1 TO 11:PRINT TAB(46) CHR$(186);:NEXT
480 PRINT TAB(46) CHR$(204);
490 LOCATE 15,47:PRINT STRING$(34,205);
500 FOR X=13 TO 20:PRINT TAB(46) CHR$(186);:NEXT
510 LOCATE 24,1:PRINT STRING$(45,205);CHR$(188);:COLOR COL7
520 LOCATE 1,1
530 PRINT "USE THE "CHR$(24)" AND "CHR$(25)" KEYS TO SELECT AND THE Del KEY ";
540 PRINT "TO MARK THE FILE(S) TO DELETE.
550 PRINT "PRESS THE SPACE BAR TO ADVANCE THE LISTING ON THE SCREEN ";
560 PRINT "(YOU CANNOT COME BACK)
570 LOCATE 4,48:PRINT"PRESS THE ESCAPE KEY TO EXIT
580 LOCATE 5,48:PRINT"FROM THIS PROGRAM.
590 LOCATE 7,48:PRINT"TO VIEW THE CONTENTS OF A FILE,
600 LOCATE 8,48:PRINT"MOVE THE CURSOR TO THE NAME,
610 LOCATE 9,48:PRINT"THEN TYPE THE LETTER "CHR$(34)"T"CHR$(34)"."
620 LOCATE 10,48:PRINT"USE CONTROL / NUM LOCK
630 LOCATE 11,48:PRINT"TO CONTROL SCROLLING.
640 LOCATE 13,48:PRINT"PRESS <ENTER> WHEN YOU ARE DONE
650 LOCATE 14,48:PRINT"SELECTING FILES TO DELETE.
660 KEY 15,CHR$(&H40)+CHR$(83)     'ASSIGN SPECIAL FUNCTION KEYS
670 KEY 16,CHR$(&H40)+CHR$(1)
680 ON KEY(11)GOSUB 790:KEY(11)ON
690 ON KEY(14)GOSUB 810:KEY(14)ON
700 ON KEY(15)GOSUB 950:KEY(15)ON
710 ON KEY(16)GOSUB 1340:KEY(16)ON
720 OPEN "FILE.LST" FOR INPUT AS #1   'GET DIR LISTING FROM DISK
730 GOSUB 830
740 C$=INKEY$
750 IF C$=" "THEN ROW=4:GOSUB 830
760 IF C$=CHR$(13) THEN 1120
770 IF C$="T" THEN GOSUB 1420
780 GOTO 740
790 IF CSRLIN>4 THEN LOCATE CSRLIN-1,1
800 RETURN
810 IF CSRLIN<23 THEN LOCATE CSRLIN+1,1
820 RETURN
830 IF DONE=1 THEN BEEP:RETURN
840 LOCATE 4,1
850 FOR X=1 TO 20
860 IF NOT EOF(1) THEN 900
870 IF EOF(1) THEN CLOSE #1:DONE=1:COLOR COL2
880 PRINT "****END OF LISTING HAS BEEN REACHED****
890 COLOR COL7:LOCATE ROW,1,1,0,7:RETURN
900 INPUT #1,A$
910 PRINT A$
920 NEXT
930 LOCATE ROW,1,1,0,7
940 RETURN
950 IF POS(0)>1 THEN BEEP:RETURN
960 IF Z=80 THEN COLOR COL7:GOTO 1120
970 COLOR COL4:Z=Z+1
980 FOR X=1 TO 12
990 IF X=9 THEN FILE$(Z)=FILE$(Z)+"."
1000 V=SCREEN(CSRLIN,X,1):IF V MOD 16=4 THEN BEEP:Z=Z-1:GOTO 1090
1010 IF V MOD 16=15 THEN BEEP:Z=Z-1:GOTO 1090  'TEST FOR FILE ALREADY MARKED
1020 C=SCREEN(CSRLIN,X)
1030 IF C=32 THEN 1070
1040 C$=CHR$(C)
1050 FILE$(Z)=FILE$(Z)+C$
1060 LOCATE CSRLIN,X:PRINT C$;
1070 NEXT
1080 Y=CSRLIN:LOCATE 25,1:PRINT FILE$(Z);"         ";:LOCATE Y,X
1090 COLOR COL7
1100 IF CSRLIN<23 THEN LOCATE CSRLIN+1,1
1110 RETURN 740
1120 CLS:LOCATE 4,1
1130 FOR X=1 TO Z
1140 IF X>60 THEN LOCATE X-57,61:GOTO 1170  'FORMAT SCREEN LISTING OF
1150 IF X>40 THEN LOCATE X-37,41:GOTO 1170  'MARKED FILENAMES
1160 IF X>20 THEN LOCATE X-17,21:GOTO 1170
1170 PRINT USING"###";X;:PRINT " "+FILE$(X)
1180 NEXT
1190 LOCATE 1,1,0
1200 PRINT "THESE ARE THE FILES THAT WILL BE ";:COLOR COL14:PRINT "DELETED";
1210 COLOR COL7:PRINT " FROM DRIVE ";B$;". IS THIS OK?
1220 PRINT "ENTER THE NUMBER OF ONE FILE TO ";CHR$(34);"UNDELETE";CHR$(34);
1230 PRINT " OR JUST <ENTER> IF LIST IS CORRECT.":INPUT "",I
1240 IF I=0 THEN 1260
1250 FILE$(I)="":GOTO 1120
1260 CLS:LOCATE 5,20:PRINT "DELETING FILES. PLEASE STAND BY.
1270 FOR X=1 TO Z
1280 LOCATE 8,1:PRINT STRING$(20," ")
1290 LOCATE 8,1:PRINT B$+":"+FILE$(X)
1300 KILL B$+":"+FILE$(X)
1310 NEXT
1314 CLOSE                      '** ADDED BY TOM D. HALL **"
1315 KILL B$+":FILE.LST"        '** ADDED BY TOM D. HALL **"
1320 SCREEN ,,0,0:LOCATE ,,,7,7:CLS
1330 LOCATE 5,20:PRINT "*********** FINISHED *************":GOTO 1350
1340 SCREEN ,,0,0:LOCATE ,,,7,7:CLS
1350 LOCATE 1,1:END
1360 IF ERR=53 THEN RESUME 1310 ELSE IF ERR=64 THEN RESUME 1310
1370 IF ERR=76 THEN RESUME 1310 ELSE PRINT "OTHER ERROR"  'IGNORE THESE ERRORS
1380 DEF SEG:A=PEEK(&H30):B=PEEK(&H31)   'GET OFFSET TO START OF PROGRAM TEXT
1390 SHELL SHEL$                         'EXECUTE DOS COMMAND
1400 DEF SEG:POKE &H30,A:POKE &H31,B     'RESTORE OFFSET TO START OF PROGRAM
1410 RETURN
1420 FOR X=1 TO 12                  'GET FILENAME TO USE IN DOS "TYPE" COMMAND
1430 IF X=9 THEN TYPE$=TYPE$+"."
1440 C=SCREEN(CSRLIN,X)
1450 IF C=32 THEN 1480
1460 C$=CHR$(C)
1470 TYPE$=TYPE$+C$
1480 NEXT
1490 ROW=CSRLIN                               'GET CURRENT ROW
1500 SCREEN ,,0,0:COLOR COL7,COL1,COL1:CLS    'CHANGE DISPLAY PAGE OF C/G ADPT
1510 SHEL$="TYPE "+B$+":"+TYPE$:GOSUB 1380    'FILENAME TO TYPE
1520 COLOR COL2:LOCATE 25,4
1530 PRINT"          ********* STRIKE ANY KEY TO RETURN TO PROGRAM ********";
1540 COLOR COL7
1550 TYPE$=""
1560 D$=INKEY$:IF D$="" THEN 1560
1570 SCREEN ,,1,1:LOCATE ROW,1,1,0,7          'RETURN TO FORMER DISPLAY PAGE
1580 RETURN
49990 REM ---- Switch to Color Monitor    ** Added by Tom D. Hall **
50000 KEY OFF   'turn off 25th line
50010 CLS       'clear screen
50020 LOCATE ,,0 'turn off cursor
50030 DEF SEG =0 'address bios
50040 POKE &H410,(PEEK(&H410) AND &HCF) OR &H10 'change equipment parameter
50050 DEF SEG   'address default memory
50060 SCREEN 1  'set medium resolution graphics
50070 SCREEN 0  'set text mode
50080 WIDTH 80  'set width to 80 characters
50090 WIDTH 40  'set width to 40 characters
50100 LOCATE ,,1,6,7    'turn on cursor
50110 SCREEN 1,0 'set medium resolution graphics and enable color
50120 COLOR 0,0  'set background to black and select palette 0
50130 RETURN
